﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace domain
{
    class Account
    {
        public Guid ID { get; internal set; }
        public String NameFirst { get; internal set; }
        public String NameLast { get; internal set; }
        public String NameDisplay { get; internal set; }
        public String Login { get; internal set; }
        public String Password { get; internal set; }
        public int PIN { get; internal set; }
        public String Email { get; internal set; }
        public List<SecurityQuestion> SecurityQuestions { get; internal set; }

        public Boolean Valid
        {
            get
            {
                return ID != null && NameFirst != null && NameFirst != String.Empty && NameLast != null && NameLast != String.Empty &&
                    NameDisplay != null && NameDisplay != String.Empty && Login != null && Login != String.Empty &&
                    Password != null && Password != String.Empty && PIN != null && PIN >= 0 && PIN <= 10000 &&
                    Email != null && Email != String.Empty && SecurityQuestions.Count > 0 && ValidateSecurityQuestions();
            }
        }

        private Boolean ValidateSecurityQuestions()
        {
            Boolean valid = true;
            foreach (SecurityQuestion SQ in SecurityQuestions)
            {
                if (!SQ.Valid)
                {
                    valid = false;
                }
            }
            return valid;
        }
    }
}
